<div class="am-u-sm-12 widget main-w">
	<ol class="am-breadcrumb">
		<li><a href="{:url('/admin/index')}">首页</a></li>
		<li><a href="{:url('index')}">调度中心</a></li>
		<li class="am-active">订单统计</li>
	</ol>
	<form class="am-form-inline tpl-form-border-form" action="" method="get">
		<div class="am-u-sm-12 ">

			<div class="am-u-sm-3" style="padding:5px 0;">

				<div class="am-u-sm-6 cl-p">
					<div class="am-u-sm-11 cl-p">
						<input type="text" class="am-form-field tpl-form-no-bg begintime" placeholder="起始时间" name="start" data-am-datepicker="" readonly="" value="{$Think.get.begintime}">
					</div>
					<div class="am-u-sm-1 cl-p" style="text-align: center;">-</div>
				</div>
				<div class="am-u-sm-6 cl-p">
					<div class="am-u-sm-12 cl-p">
						<input type="text" class="am-form-field tpl-form-no-bg endtime" placeholder="结束时间" name="end" data-am-datepicker="" readonly="" value="{$Think.get.endtime}">
					</div>
				</div>
			</div>
			<div class="am-form-group am-u-sm-9" style="padding-top: 6px;">
				<button type="submit" class="am-btn am-btn-sm am-btn-primary am-radius">查询<i class="am-icon-search"></i></button>
			</div>

		</div>
		<div style="padding: 20px;" class="am-u-sm-12">
			<div class="am-form-group timeclassify">
				<input type="hidden" name="time" class="time" value="{$Think.get.time}" />
				<!--<a href="{:url('stat',['time'=>'all'])}" class="am-btn am-radius am-btn-sm {if input( 'param.time')=='all'}  am-btn-success{else/}am-btn-primary{/if} year" style="margin-top: -2px;">全部</a>-->
				<a href="{:url('stat',['time'=>'day'])}" class="am-btn {:input( 'param.time')=='day'?'am-btn-success':'am-btn-primary' } am-btn-sm am-radius day" style="margin-top: -2px;">今日</a>
				<a href="{:url('stat',['time'=>'month'])}" class="am-btn am-btn-sm {:input( 'param.time')==month?'am-btn-success':'am-btn-primary'} am-radius month" style="margin-top: -2px;">本月</a>
				<a href="{:url('stat',['time'=>'year'])}" class="am-btn am-radius am-btn-sm {if input( 'param.time')} {if input( 'param.time')=='year'}  am-btn-success{else/}am-btn-primary{/if} {else/}am-btn-success{/if}  year" style="margin-top: -2px;">今年</a>
			</div>
		</div>
	</form>
	<div style="padding: 10px;" class="am-u-sm-12">
		<div class="am-u-sm-12 ">
			<div class="am-tabs" data-am-tabs="{noSwipe: 1}">
				<ul class="am-tabs-nav am-nav am-nav-tabs">
					<li class="am-active">
						<a href="#tab1">总订单数</a>
					</li>
					<li>
						<a href="#tab2">总订单金额</a>
					</li>
					<li>
						<a href="#tab3">总耗时</a>
					</li>
				</ul>

				<div class="am-tabs-bd">
					<div class="am-tab-panel am-fade am-in am-active" id="tab1">
						<div class="widget">
							<div class="widget-head am-cf">
								<div class="am-fl">总订单数</div>
								<small style="margin-left: 5px;">共计{:array_sum($qty)}单</small>
							</div>
							<div class="widget-body" style="height: 300px">
								<div class="am-u-sm-6">
									<div style="height: 260px" class="" id="allorder">

									</div>
								</div>
								<div class="am-u-sm-6">
									<table class="am-table am-table-compact am-table-bordered am-table-radius am-table-striped tpl-table-black am-text-nowrap">
										<thead>
											<tr>
												<th>订单类别</th>
												<th>订单数</th>
												<th>占比</th>
											</tr>
										</thead>
										<tbody>
											{foreach $types as $key => $type}
											<tr>
												<td>{$type}</td>
												<td>{$qty[$key]?:"0"}</td>
												<td>
													{if $qty[$key]}
														{if array_sum($qty)==0}
														0{else/}
														{:round($qty[$key]/(array_sum($qty))*100,2)}
														{/if}
													{else/}0
													{/if}%</td>
											</tr>
											{/foreach}
											
										</tbody>
									</table>
								</div>
							</div>
						</div>
					</div>
					<div class="am-tab-panel am-fade" id="tab2">
						<div class="widget" >
							<div class="widget-head am-cf">
								<div class="am-fl">总订单金额</div>
								<small style="margin-left: 5px;">共计{:array_sum($price)}元</small>
							</div>
							<div class="widget-body " style="height: 300px">
								<div class="am-u-sm-6">
									<div style="height: 260px" class="" id="allmoneny">

									</div>
								</div>
								<div class="am-u-sm-6">
									<table class="am-table am-table-compact am-table-bordered am-table-radius am-table-striped tpl-table-black am-text-nowrap">
										<thead>
											<tr>
												<th>订单类别</th>
												<th>订单金额</th>
												<th>占比</th>
											</tr>
										</thead>
										<tbody>
											{foreach $types as $key => $type}
											<tr>
												<td>{$type}</td>
												<td>{$price[$key]?:"0"}</td>
												<td>{if $price[$key]}
														{if array_sum($price)==0}
														0{else/}
														{:round($price[$key]/(array_sum($price))*100,2)}
														{/if}
													{else/}0
													{/if}%</td>
											</tr>
											{/foreach}
											
										</tbody>
									</table>
								</div>
							</div>
						</div>
					</div>
					<div class="am-tab-panel am-fade" id="tab3">
						<div class="widget" >
							<div class="widget-head am-cf">
								<div class="am-fl">总耗时</div>
								<small style="margin-left: 5px;">共计{:intval(array_sum($time)/3600)}小时</small>
							</div>
							<div class="widget-body " style="height: 300px">
								<div class="am-u-sm-6">
									<div style="height: 260px" class="" id="alltime">

									</div>
								</div>
								<div class="am-u-sm-6">
									<table class="am-table am-table-compact am-table-bordered am-table-radius am-table-striped tpl-table-black am-text-nowrap">
										<thead>
											<tr>
												<th>订单类别</th>
												<th>订单耗时</th>
												<th>占比</th>
											</tr>
										</thead>
										<tbody>
											{foreach $types as $key => $type}
											<tr>
												<td>{$type}</td>
												<td>{if intval($time[$key]/3600)==0}{else/}{:intval($time[$key]/3600)}小时{/if}{:intval(($time[$key]-intval($time[$key]/3600)*3600)/60)}分钟</td>
												<td>
													{if $time[$key]}
														{if array_sum($time)==0}
														0{else/}
														{:round($time[$key]/(array_sum($time))*100,2)}
														{/if}
													{else/}0
													{/if}%</td>
											</tr>
											{/foreach}
											
										</tbody>
									</table>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>

		</div>
		<div class="am-u-sm-12 ">

		</div>
		<div class="am-u-sm-12 ">

		</div>
	</div>

</div>